package com.ghck.server.controller.events;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import org.springframework.context.event.SimpleApplicationEventMulticaster;
import org.springframework.core.task.TaskExecutor;
import org.springframework.stereotype.Component;

@Component(value="applicationEventMulticaster")
public class AsyncApplicationEventMulticaster extends SimpleApplicationEventMulticaster{
	
	private TaskExecutor taskExecutor = new TaskExecutor() {
		ExecutorService service = Executors.newCachedThreadPool();
		@Override
		public void execute(Runnable task) {
			service.execute(task);
		}
	};

	@Override
	protected Executor getTaskExecutor() {
		return taskExecutor;
	}
	

}
